package com.zhaosc.mybatis.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zhaosc.mybatis.mapper.UserMapper;
import com.zhaosc.mybatis.model.SysUser;
import com.zhaosc.mybatis.service.IUserService;
import com.zhaosc.mybatis.shared.db.DataSourceEnum;
import com.zhaosc.mybatis.shared.db.DataSourceSwitch;

@Service
public class UserServiceImpl implements IUserService {
	
	@Autowired
	UserMapper userMapper;
	
	@Override
	@DataSourceSwitch(dataSource=DataSourceEnum.MASTER)
	public SysUser selectById(Long id) {
		SysUser sysUser=userMapper.selectById(id);
		return sysUser;
	}

	@Override
	@DataSourceSwitch(dataSource=DataSourceEnum.SLAVER)
	public SysUser selectById2(Long id) {
		SysUser sysUser=userMapper.selectById(id);
		return sysUser;
	}
	

}
